<script>
	import {
		mapState,
		mapMutations
	} from 'vuex'
	export default {
		methods: {
			...mapMutations(['login', 'token']),
		},

		onLaunch: function() {
			//获取本地token,保存登录状态
			const _this = this;
			uni.getStorage({ //获得保存在本地的token
				key: 'token',
				success: (res) => {
					_this.token(res.data); //从新赋值token
					uni.request({ // 再次校验并刷新token的有效时间  
						url: 'http://www.huanqiuyt.com/api/token/check',
						header: {
							"Content-Type": "application/x-www-form-urlencoded",
							"token": res.data
						},
						data: {
							"token": res.data
						},
						method: "GET",
						success: (e) => {
							if (e.data.code == 1) {
								_this.token(e.data.data.token); //从新赋值token
							}
						}
					})
				}
			});

			//底部tabBar状态
			// setTimeout(() => {
			// 	uni.setTabBarBadge({
			// 		index: 1,
			// 		text: '35'
			// 	});
			// 	uni.showTabBarRedDot({
			// 		index: 3
			// 	});
			// }, 1000);

		},
		onShow: function() {
			console.log('App Show');
		},
		onHide: function() {
			console.log('App Hide');
		}
	}
</script>

<style>
	/* uni.css - 通用组件、模板样式库，可以当作一套ui库应用 */
	/* @import './common/uni.css'; */
	@import './common/iconfont.css';

	/*每个页面公共css */
	/* uni-app默认全局使用flex布局。因为flex布局有利于跨更多平台，尤其是采用原生渲染的平台。如不了解flex布局，请参考http://www.w3.org/TR/css3-flexbox/。如不使用flex布局，请删除或注释掉本行。*/
	body,
	page {
		min-height: 100%;
		display: flex;
		background: #FEFEFE;
	}

	/* #ifdef MP-BAIDU */
	page {
		width: 100%;
		height: 100%;
		display: block;
	}

	swan-template {
		width: 100%;
		min-height: 100%;
		display: flex;
	}

	/* #endif */

	/* 原生组件模式下需要注意组件外部样式 */
	m-input {
		width: 100%;
		min-height: 100%;
		display: flex;
	}

	.content {
		display: flex;
		flex: 1;
		flex-direction: column;
		/* background-color: #efeff4; */

	}

	.input-group {
		background-color: #ffffff;
		margin-top: 40upx;
		position: relative;
	}

	/* .input-group::before {
		position: absolute;
		right: 0;
		top: 0;
		left: 0;
		height: 1upx;
		content: '';
		-webkit-transform: scaleY(.5);
		transform: scaleY(.5);
		background-color: #1D7BFF;
	} */

	.input-group::after {
		position: absolute;
		right: 0;
		bottom: 0;
		left: 0;
		height: 1upx;
		content: '';
		-webkit-transform: scaleY(.5);
		transform: scaleY(.5);
		background-color: #1D7BFF;
	}

	.input-row {
		display: flex;
		flex-direction: row;
		position: relative;
	}

	.input-row .image {
		width: 20%;
		height: 50upx;
		min-height: 50upx;
		line-height: 50upx;
	}

	.input-row.border::after {
		position: absolute;
		right: 0;
		bottom: 0;
		left: 15upx;
		height: 1upx;
		content: '';
		-webkit-transform: scaleY(.5);
		transform: scaleY(.5);
		background-color: #1D7BFF;
	}

	.btn-row {
		margin: 100upx auto 0;
		padding: 20upx;
		width: 80%;
	}

	button.primary {
		background-color: #1D7BFF;
	}

	.cl {
		color: rgba(3, 173, 143, 1);
	}

	.cr {
		color: rgba(209, 75, 100, 1);
	}

	.vertical {
		display: flex;
		flex-direction: column;
		/* align-items: center; */
		justify-content: space-between;
		/* flex-wrap: wrap; */
	}

	.constant {
		display: flex;
		justify-content: space-around;
		flex-direction: row;
		flex-wrap: wrap;
	}

	.smallBtn {
		width: 326upx;
		height: 70upx;
		text-align: center;
		line-height: 70upx;
		background: rgba(29, 123, 255, 1);
		color: #fff;
		/* margin-top: 40upx; */
		font-size: 14px;
		box-shadow: 0 3px 10px rgba(46, 81, 255, 0.74);
	}

	.Detailed .uni-drawer-content {
		width: 40% !important;
	}

	.userPage .uni-drawer-content {
		width: 40% !important;
	}

	/* ._swiper {
		height: 100% !important;
	}
	
	.uni-swiper-slide-frame {
		width: 100% !important;
	} */

	.uni-tabbar__icon {
		width: 20px !important;
		height: 20px !important;
	}

	.status_bar {
		height: var(--status-bar-height);
		width: 100%;
		background-color: #F8F8F8;
	}

	.top_view {
		height: var(--status-bar-height);
		width: 100%;
		position: fixed;
		background-color: #F8F8F8;
		top: 0;
		z-index: 999;
	}

	/* .uni-swiper-dots-horizontal {
		display: none;
	} */
	.uni-swiper-dots-horizontal .uni-swiper-dot {
		background: rgba(255, 255, 255, 0.6) !important;
	}

	.uni-swiper-dots-horizontal .uni-swiper-dot-active {
		background: #fff !important;
	}

	/* 展示底部 popup */
	.uni-popup-bottom {
		height: max-content !important;
	}

	.m-input-view {
		padding: 0 !important;
	}

	.uni-popup {
		position: fixed !important;
	}
</style>
